package com.roncoo.education.user.service.api.pc;

import com.roncoo.education.user.common.req.UserTagPageREQ;
import com.roncoo.education.user.common.req.UserTagSaveREQ;
import com.roncoo.education.user.common.req.UserTagUpdateREQ;
import com.roncoo.education.user.common.resq.UserTagPageRESQ;
import com.roncoo.education.user.service.api.pc.biz.PcApiUserTagBiz;
import com.roncoo.education.util.base.BaseController;
import com.roncoo.education.util.base.Page;
import com.roncoo.education.util.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 标签用户信息
 */
@RestController
@RequestMapping(value = "user/pc/user/tag")
@Api("后台-用户管理-用户标签")
public class PcApiUserTagController extends BaseController {

    @Autowired
    private PcApiUserTagBiz biz;

    /**
     * 标签用户分页列出
     * @param userTagPageREQ
     * @author wangrong
     */
    @ApiOperation(value = "标签用戶分页列出接口", notes = "标签用戶")
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public Result<Page<UserTagPageRESQ>> listForPage(@RequestBody UserTagPageREQ userTagPageREQ) {
        return biz.listForPage(userTagPageREQ);
    }

    //后台添加标签
    @ApiOperation(value = "添加用户标签", notes = "添加用户标签")
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    @Transactional
    public Result<String> save(@RequestBody UserTagSaveREQ userTagSaveREQ) {
        return biz.save(userTagSaveREQ);
    }

    //后台修改标签
    @ApiOperation(value = "修改用户标签", notes = "修改用户标签")
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @Transactional
    public Result<String> update(@RequestBody UserTagUpdateREQ userTagUpdateREQ) {
        return biz.update(userTagUpdateREQ);
    }

}
